<?php
namespace gnomephp\form;

abstract class FormField{
	
	
	protected $id;
	
	protected $name;
	
	protected $value;
	
	protected $props=array();
	
	/**
	 * 
	 * @var gnomephp\Url
	 */
	protected $url;
	
	public function __construct($formId, $url, $name, $value = null, $props=array()){
		$this->id = $formId . '_' . $name;	
		$this->name = $name;
		$this->value = $value;
		$this->url = $url;
		$this->props = $props;
	}
	
	
	protected function buildProps($props){
		$str = '';
		foreach($props as $key => $val){
			$str .= ' ' . $key . '=' . '"'.$val.'"';
		}
		return $str;
	}
	
	
	public function getId(){
		return $this->id;
	}
	
	public function getName(){
		return $this->name;
	}
	
	public function getValue(){
		return $this->value;
	}
	
}